package cn.maszy.action.systemsetting;

import org.springframework.beans.factory.annotation.Autowired;

import net.sourceforge.stripes.action.SessionScope;
import cn.maszy.common.BaseAction;
import cn.maszy.common.Pager;
import cn.maszy.model.systemsetting.C_T_Sys_Module;
import cn.maszy.service.systemsetting.C_T_Sys_ModuleService;
@SessionScope
public class moduleAction extends BaseAction<C_T_Sys_Module> {
	/**
	 * 模块创建
	 */
	private static final long serialVersionUID = 6179604301571294802L;
	/**
	 * 调用 bean
	 */
	private C_T_Sys_Module c_T_Sys_Module;
	/**
	 * 调用service执行增删改查方法
	 */
	@Autowired
	private C_T_Sys_ModuleService c_T_Sys_ModuleService;
	/**
	 * 画面复选框
	 */
	private String checkIds;
	/*********************class set/get****************************/
	public C_T_Sys_Module getC_T_Sys_Module() {
		return c_T_Sys_Module;
	}
	public void setC_T_Sys_Module(C_T_Sys_Module c_T_Sys_Module) {
		this.c_T_Sys_Module = c_T_Sys_Module;
	}
	public String getCheckIds() {
		return checkIds;
	}
	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}
	/*******************STRUTS ACTION METHOD*************************/
	/**
	 * 删除一条记录
	 * @Author:Arthur
	 * @Time:2012-10-19
	 * @Parameter:@return
	 * @Parameter:@throws Exception
	 * @Return:String
	 * @Throws
	 */
	public String moduleDel() throws Exception{
		int i=c_T_Sys_ModuleService.delete(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "ModuleList", "","forward", "systemsetting/ModuleList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 查询单条记录
	 * @Author:Arthur
	 * @Time:2012-10-19
	 * @Parameter:@return
	 * @Parameter:@throws Exception
	 * @Return:String
	 * @Throws
	 */
	public String moduleDetail() throws Exception{
		if(c_T_Sys_Module==null){
			c_T_Sys_Module=c_T_Sys_ModuleService.selectOne("");
		}else{
			c_T_Sys_Module=c_T_Sys_ModuleService.selectOne(c_T_Sys_Module.getModuleuuid());
		}
		return SUCCESS;
	}
	/**
	 * 查询List
	 * @Author:Arthur
	 * @Time:2012-10-19
	 * @Parameter:@return
	 * @Parameter:@throws Exception
	 * @Return:String
	 * @Throws
	 */
	public String moduleList() throws Exception{
		pager = new Pager<C_T_Sys_Module>(pageNum, numPerPage,orderField,orderDirection);
		pager= c_T_Sys_ModuleService.selectList(c_T_Sys_Module,pager);
		return SUCCESS;
	}
	/**
	 * 新增/修改
	 * @Author:Arthur
	 * @Time:2012-10-19
	 * @Parameter:@return
	 * @Return:String
	 * @Throws
	 */
	public String moduleUpdate(){
		int i=c_T_Sys_ModuleService.update(c_T_Sys_Module);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "ModuleList","", "forward", "systemsetting/ModuleList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
}
